package FlyWeight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author duanzhizhou
 * @date 2024/11/5
 */
public class WebsiteFactory {
    private final Map<String, Website> map = new HashMap<>();
    
    public Website create(String type) {
        if (!map.containsKey(type)) {
            map.put(type, new ConcreteWebsite(type));
        }
        return map.get(type);
    }
    
    public int size() {
        return map.size();
    }
    
}
